import request from './request'
/* 登录 */
export function login (data) {
  return request({
    method: 'POST',
    url: '/app/v1_0/authorizations',
    data
  })
}
// 获取验证码
export function getCode (mobile) {
  return request({
    method: 'get',
    url: `/app/v1_0/sms/codes/${mobile}`
  })
}
// 获取用户信息
export function getUserData () {
  return request({
    method: 'get',
    url: '/app/v1_0/user'
  })
}
// 得到用户频道列表
export function getUserChannels () {
  return request({
    method: 'GET',
    url: '/app/v1_0/user/channels'
  })
}
// 增加用户频道
export function addUserChannels (data) {
  return request({
    method: 'PATCH',
    url: '/app/v1_0/user/channels',
    data
  })
}
// 删除用户频道
export function deleteUserChannels (channelId) {
  return request({
    method: 'DELETE',
    url: `/app/v1_0/user/channels/${channelId}`
  })
}
// 关注用户
export function followUser (autId) {
  return request({
    method: 'POST',
    url: '/app/v1_0/user/followings',
    data: {
      target: autId
    }
  })
}
// 取消关注用户
export function cancelFollowUser (autId) {
  return request({
    method: 'DELETE',
    url: `/app/v1_0/user/followings/${autId}`
  })
}
// 修改用户个人资料
export function updateUserInfo (data) {
  return request({
    method: 'patch',
    url: '/app/v1_0/user/profile',
    data
  })
}
// 获取用户个人资料
export function getUserInfo (id) {
  return request({
    method: 'GET',
    url: '/app/v1_0/user/profile',
    target: id
  })
}
// 更新用户头像,这段代码知识后面要补充,赶时间没看
export function updateUserPhoto (data) {
  return request({
    method: 'PATCH',
    url: '/app/v1_0/user/photo',
    data
  })
}
